﻿﻿﻿﻿﻿namespace DeviceCommons.DeviceMessages.Abstractions
{
    public interface IMessageParser<T> : IMessagePayload<T>
    {
        Func<string, string>? DecryptFunc { get; set; }
        Func<byte[], byte[]>? DecompressFunc { get; set; }

        T Parser(ReadOnlySpan<byte> bytes);

        T Parser(string data);

        T Parser(string data, string? password);

        Task<T> ParserAsync(byte[] bytes, CancellationToken cancellationToken = default);

        Task<T> ParserAsync(string data, CancellationToken cancellationToken = default);

        Task<T> ParserAsync(string data, string? password, CancellationToken cancellationToken = default);
    }
}
